﻿using EntityFramework.Entity.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YouTravel.DomainModels;

namespace Repositories.Configuration
{
    public class BranchMap : EntityConfigurationBase<Branch>
    {
        public BranchMap()
        {
            this.Property(p => p.Name).HasMaxLength(50).IsRequired();
            this.Property(p => p.GrossMargin).HasPrecision(18,2).IsRequired();
            this.Property(p => p.CounterFeeRate).HasPrecision(18, 2).IsRequired();
            this.Property(p => p.UpdaterName).HasMaxLength(20);

            this.HasRequired(p => p.Creater).WithMany().HasForeignKey(f=>f.CreaterId);
            this.HasOptional(p => p.Updater).WithMany().HasForeignKey(f=>f.UpdaterId);

        }
    }
}
